import cv2
import matplotlib.pyplot as plt
import numpy as np

# img = cv2.imread("9.png")
# img = cv2.resize(img, (28, 28))
# cv2.imshow('image', img)
# cv2.waitKey(0)
# plt.imshow(img[:, :, ::-1])

img = cv2.imread("9.png")  # 读取图片
img = cv2.resize(img, (28, 28))  # 重置图片大小
img = img[:, :, 0:1]
plt.imshow(img[:, :, ::-1])
plt.waitforbuttonpress()

np.reshape(img, (1, 28, 28))
